package org.lem

class StudentLearningActivity {

  static belongsTo = [classRoster: ClassRoster, student: Student]

  Date classDate
  String inputBy
  Date inputDate

  static constraints = {
    student()
    classRoster()
    classDate(nullable: true)
    inputBy()
    inputDate()
  }

  String toString() {
    def toStringVal = "${student} ${classDate} ${classRoster.getScheduledClass().getLocation()} ${classRoster.getScheduledClass().getClassTime()} ${classRoster.getScheduledClass().getSkillLevel().getSkillLevel()}"


    if(null != classRoster.getScheduledClass().getSession()) {
      toStringVal += " ${classRoster.getScheduledClass().getSession().getName()}"
    }

    return toStringVal
  }

  //TODO: implement compareTo: compare on class date first, name second  

}
